.TH std::packaged_task::operator() 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::packaged_task::operator() \- std::packaged_task::operator()

.SH Synopsis
   void operator()( ArgTypes... args );  \fI(since C++11)\fP

   Calls the stored task as if by INVOKE<R>(f, args...), where f is the stored task.
   The return value of the task or any exceptions thrown are stored in the shared
   state. The shared state is made ready and any threads waiting for this are
   unblocked.

.SH Parameters

   args - the parameters to pass on invocation of the stored task

.SH Return value

   \fI(none)\fP

.SH Exceptions

   std::future_error on the following error conditions:

     * The stored task has already been invoked. The error category is set to
       promise_already_satisfied.
     * *this has no shared state. The error category is set to no_state.

.SH Example

    This section is incomplete
    Reason: no example

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

      DR    Applied to         Behavior as published              Correct behavior
                       a successful call to operator()       no additional
                       synchronized with                     synchronization
   LWG 2142 C++11      a call to any member function of a    guarantees other than what
                       std::future or                        is
                       std::shared_future that share their   already provided by shared
                       shared state with *this               state

.SH See also

                             executes the function ensuring that the result is ready
   make_ready_at_thread_exit only once the current thread exits
                             \fI(public member function)\fP

.SH Category:
     * Todo no example
